The present invention relates to a memory card having an erasable programmable nonvolatile memory such as a flash memory and, more particularly, to improvements in a technique of dynamically assigning a physical address of a memory area in association with a logical address.
When a write error or the like occurs in a memory card, an error block is replaced with a spare memory block. In such a replacing technique, a spare area management table is provided. When a sector validity flag provided for a sector management area in a memory block unit such as a sector indicates an “invalid state”, a spare sector address is obtained from the spare area management table. With respect to a sector of the spare sector address, similarly, the sector management area is read and its validity is determined. If the area is invalid, a spare sector address is similarly obtained from the spare area management table.
A patent document 1 (described later) discloses a configuration in which a data memory area for storing file data, a spare memory area for replacing an error area, and an error memory area for storing error information of the data memory area are provided in a flash memory mounted on a memory card, and the address of a spare memory of a data memory having an error is stored into the error memory area (refer to FIG. 2).
A patent document 2 (described later) discloses a technique in which, at the time of writing data, in a manner similar to an optical disk, storage data and a storage location are not associated with each other. When data is written, the data is added. In the case of rewriting a file already written, the storage area of the old file is invalidated to an erasable area and garbage collection for erasing data in the invalid area is performed at a certain timing (refer to the fourth and eighth columns). In this technique, for file management, a logical sector table, a physical sector table, and a status table are used. By using the logical sector table, a location in a flash memory in which data of a logic sector is mapped can be referred to. By the physical sector table, the logical sector number of file data mapped to a physical sector can be referred to. By the status table, the status of each physical sector can be referred to. For example, in writing operation, a write pointer showing a sector to which the next data is to be written is set, and whether the sector indicated by the pointer is in a writable state or not can be determined by referring to the status table. In the status table, a flag indicative of deterioration due to a large number of erasing times and a flag indicating that data is already written exist. When any of the flags is set and data cannot be written, a control of moving the pointer to the next sector is executed.
Patent Document 1
Japanese Unexamined Patent Publication No. Hei 5(1993)-204561 (U.S. Pat. No. 5,644,539)
Patent Document 2
Japanese Unexamined Patent Publication No. Hei 6(1994)-124596